﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace MathLib.Common
{
    internal class CompiledRegex
    {
        internal static Regex IntegerPattern = new Regex(@"(\+|-)?[1-9]+", RegexOptions.Compiled);
        internal static Regex VariablePattern = new Regex(@"[a-zA-Z]+", RegexOptions.Compiled);
        //TODO: Improve on the patterns
        //internal static Regex CoefficientPattern = new Regex(@"\b(?<value>([0-9](\.)?)+)[a-zA-Z]", RegexOptions.Compiled);
        internal static Regex CoefficientPattern = new Regex(@"(?<value>(?<sign>((\+|-)?))\b(?<coef>([0-9](\.)?)+))[a-zA-Z]", RegexOptions.Compiled);
        //internal static Regex VariableWithExponentPattern = new Regex(@"(([a-zA-Z]+-?(([1-9])*)?))+", RegexOptions.Compiled);
        internal static Regex VariableWithExponentPattern = new Regex(@"([a-zA-Z]+-?(([1-9])*)?)(?![a-zA-z])*", RegexOptions.Compiled);
        internal static Regex MonomialPattern = new Regex(@"(([1-9]*)?([a-zA-Z])+-?([1-9]*)?)+", RegexOptions.Compiled);
    }
}